package com.example.comiccenter.controller;


import com.example.comiccenter.domain.Likes;
import com.example.comiccenter.service.LikeService;
import com.example.comiccenter.utils.ResultData;
import com.example.comiccenter.utils.SearchBean;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/likes")
public class LikeController {

    @Resource
    private LikeService likeService;

    //分页查询
    @PostMapping("/getAllLike")
    public ResultData selectPage(@RequestBody SearchBean<Likes> searchBean){
        System.out.println("查询like");
        return likeService.getAllLike(searchBean);
    }

    //添加收藏
    @PostMapping("/addLike")
    public ResultData addlike(@RequestBody Likes like){
        return likeService.addLike(like);
    }

    //取消收藏
    @PostMapping("/deleteLike")
    public ResultData deletelike(@RequestBody Likes like){
        System.out.println("删除like："+like);
        return likeService.deleteLike(like);
    }
}
